<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script th:src="@{webjars/jquery/3.4.1/dist/jquery.min.js}"></script>
    <script>
        $(function () {
            $(".delete").click(function () {
                var href=this.href;
                $("#f1").attr("action",href).submit();
                return false;
            });
        });
    </script>
    <style>
        h1{
            text-align: center;
            margin: 0 auto;
        }
        table{
            border-collapse: collapse;
            width: 600px;
            margin: 0 auto;
        }
        td{
            border: 1px solid black;
            height: 40px;

            line-height: 40px;
            text-align: center;
        }
        tr:nth-child(odd){
            background-color: aqua;
        }
        #p1{
            width: 600px;
            margin: 0 auto;
            text-align: right;
        }
    </style>
</head>
<body>
    <h1>条目</h1>
    <p id="p1">
    <a th:href="@{/cate/view}">新增</a>
    </p>
    <table>
        <tr th:each="cate:${lists}">
            <td th:text="${cate.id}"></td>
            <td th:text="${cate.name}"></td>
            <td th:text="${cate.pid}"></td>
            <td th:text="${cate.remark}"></td>
            <td>
                <a th:href="@{'/cate/'+${cate.id}}">修改</a>
                |
                <a class="delete" th:href="@{|/cate/${cate.id}|}">删除</a>
            </td>
        </tr>
    </table>
</body>
<form id="f1" method="post">
    <input type="hidden" name="_method" value="DELETE">
</form>
</html>